Skip to content

fix(public-boundary): unify local-path verdicts across presentation and public guards - #9080

Merged
loopx-agent merged 5 commits into
loopx-project:mainfrom
gcl-coder:codex/public-boundary-local-path
Nov 21, 2026
Merged

loopx-agent merged 5 commits into
loopx-project:mainfrom
gcl-coder:codex/public-boundary-local-path

Conversation

@gcl-coder

@gcl-coder gcl-coder commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Two public boundaries disagreed on the same local-path text, in both directions. Reproduced directly against source at ff9054376:

value presentation before public-output guard before after (both)
see file:///Users/alice/goal.md accept reject reject
path:/Users/alice/goal.md accept reject reject
///tmp/a.log reject accept reject
//Users/alex/x reject accept reject
x=/private/a accept reject reject

The public-output guard is the busiest public surface, so a tuple of guards reaching different verdicts means whether a path leaks depends on which entry point produced the text. The two leading-slash forms were also missing from the shared owner used by classify_private_text.

Review regressions this fixes: the first delegation also started accepting bare directory roots (/home/, ///var/, C:\), began rejecting ordinary http(s) links whose paths contain /home/ or /Users/, and left the global-risk TypeScript mirror without the 2+ leading-slash and directory-root rules.

Change

  • The shared text owner now recognizes the 2+ leading-slash absolute-root form alongside the existing absolute, home-relative, path:-prefixed, boundary-assignment, and file:// shapes.
  • presentation._plain_text delegates its absolute-path verdict to find_public_safe_local_path. Its existing .codex, .git and .local relative-directory rejection remains an explicit presentation policy, with the reason recorded at the definition.
  • Bare directory roots keep the baseline presentation verdict: a root with nothing after it (/home/, ///var/, C:\) is still rejected there, and the shared absolute, slash-run and ~/ arms keep their "root may end the reference" behavior.
  • Ordinary http(s) links are masked before local-path detection, preserving character positions. That covers a trailing-dot host (https://docs.example.test./home/overview), IPv6 authorities, path-shaped query values, and a /Users/ segment inside a public URL. file:// and path: remain local-path references, and credential detection keeps the raw text. The mask is applied in find_public_safe_local_path, the local-path category arms of classify_private_text, public_safe_compact_text, and the TypeScript Vision checkpoint; the publication tier (find_private_text_match) stays strict.
  • The global-risk TypeScript mirror now carries the same 2+ leading-slash and directory-root rules as Python.
  • The shared corpus pins the five table rows in both directions, including the deliberate narrower publication-tier verdict for ///tmp/a.log and x=/private/a, plus a public URL with a /Users/ path segment.
  • A real publish_extension_projection test confirms a rejected view leaves the existing projection bytes and payload digest unchanged.

Controls

https://example.com/docs, https://docs.example.test./home/overview, the token budget is 1200, and /Users/alice prose keep their current verdicts on every surface that already had them. contract.py behavior, the short-assignment credential decision (direction 2), and the other surface migrations are unchanged.

Verification

  • 376 passed: owner parity, credential caller faces, path shapes, text budget, and global-risk parity.
  • 82 passed: extension presentation and presentation public safety, including the real publish_extension_projection publish/readback pair.
  • 8 passed in the TypeScript corpus suite (node --test); npm run typecheck:control-plane passed.
  • ruff check passed on every changed Python file.
  • loopx canary premerge --tier quick --from-git-diff: 3 selected checks, 0 failures, 1 advisory (a maintainability finding outside the changed files).

Refs #5136, direction 3.

Latest revision (d18fd5843)

  • [P2] Explicit path: references keep their local context. mask_http_url_paths no longer masks the token after a path:/ or path:\ locator, so path:/https://example.com/doc stays intact and PATH_PREFIX_LOCAL_PATTERN still rejects it at every depth of validate_public_safe_value. Standalone https:// links still mask and remain accepted.
  • Regression added to EXPORT_LOCAL_REFERENCES and exercised at scalar, nested-value and nested-key depths.

Verification: 52 public-safety path-shape tests, 489 public-safety/presentation tests (5 unrelated SQLite-runtime qualification failures on this machine's Node 23.11 / SQLite 3.49), 8 TypeScript corpus tests, and ruff check all pass.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, max)

[P2] 公开视图漏拒以根分隔符结尾的目录引用

用同一合成扩展先发布合法视图,再更新为只有目录根的标题。基准拒绝三种目录根形态并保留旧快照与摘要,候选全部发布成功,按新摘要能读回。旧检查匹配目录前缀,共享检测对这些根要求后面还有内容。在共享路径 owner 保留原目标表面覆盖的根目录形态,补验 Unix、连续斜杠和盘符路径根,并验证拒绝后已发布快照和摘要不变。 相关代码

[P2] 合法 HTTPS 链接被误判为本地文件路径

将标题设为合法链接 https://docs.example.test./home/overview。基准成功发布,候选抛出本地路径错误。带 DNS 根点的域名后恰好出现普通的 home 路径段,使正则在 URL 内部起匹配。去掉根点的对照两版均可发布。让共享 owner 区分普通 HTTP(S) 链接的路径段与本地引用,保留 file URL 和明确本地引用的拒绝,以及同字段内公开链接以外的检查。 相关代码

动机 / Motivation

扩展作者发布公开面板时,需要保留可用的资料链接,并拦截指向机器文件系统的引用。

旧版会拒绝只指向本机目录根的引用,却漏过部分 file URL。新版补上 file URL,同时在相同发布入口放行了三类原本会拒绝的目录根引用,并误拒了一种合法 HTTPS 链接。

用同一合成扩展走真实发布和按摘要读回。候选写入了三个本应拒绝的目录根引用,并在合法链接上返回本地路径错误。普通 HTTPS 对照和新版拒绝 file URL 均通过。

这次核对聚焦公开视图的输入、发布和读回。凭据阈值和其他扩展权限由原有路径决定。

改动思路 / Approach

共享 owner 适合持有路径识别,扩展发布边界应保留自己的拒绝与原子替换保证。统一到匹配器前须对照旧公开视图已拒绝的值和已接受的普通链接。

本次只对齐现有扩展发布和通用公开输出的本地路径检测,并核对内部状态的 TypeScript 镜像。扩展权限和凭据策略沿用现有规则。

生产调用在写快照前验证已登记的公开视图。真正拒绝时会保留旧版本和摘要,所以用同一提供者在基准和候选各走一次发布,再按摘要读回。单个字符串分类测试无法判断回退是否保存了当前可用版本。

具体改动 / Changes

评审精确提交 bd974e1,基准 ff90543。九个文件增加 229 行、删除 14 行。三处生产代码切换路径检测与同步 Vision 匹配规则,六处测试与语料验证边界。按 issue #5136 的维护者决定 issuecomment-5857977250 核对。direction-3-local-reference 与 direction-3-public-link 仍有缺口。direction-4-real-entrypoint 已通过实际调用补验。 验收约定

关键代码讲解

  • _plain_text 改用共享路径检测,同时保留扩展的私有相对目录策略。 源码
  • LOCAL_PATH_SURFACE_PATTERN 匹配已知根和盘符。候选把这条搜索用于原先的前缀检查处,暴露了两种方向的差异。 源码
  • MULTI_SLASH_LOCAL_PATH_PATTERN 覆盖带子路径的连续斜杠引用。测试需要加上目录根本身。 源码
  • LOCAL_PATH_SHAPE 是已有 Vision 状态校验的 TypeScript 对应规则。共享语料覆盖新增匹配,实际发布调用另行验证。 源码

对主干的风险 / Risks

同一公开扩展发布路径 基准 候选
目录根引用,三种形态 拒绝,原快照保持 发布并读回
带 DNS 根点的 HTTPS 链接 发布并读回 误拒,原快照保持
普通 HTTPS 链接 发布并读回 发布并读回
合成 file URL 发布 拒绝,原快照保持

语义与 CI 对齐

复用已有 local path 类别及发布权限。将共享检测直接用于扩展视图引入了这四处回归,快照写入器仍按此前流程处理。聚焦及相邻 Python 共 478 项通过,TypeScript 82 项通过,类型检查和 Ruff 通过。标准 premerge 通过,6 项直接检查、10 项选中检查,1 项未改动代码的可维护性提示。 补充的真实发布用例在候选发现四处失败。按当前策略未查询远端 CI。

我的整体评价 / Verdict

请求修改这一提交。保留 file URL 收紧,修复目录根漏判和合法链接误判后,在同一个真实发布入口验证老快照与新读回两个方向。当前 diff 改变公开扩展视图的验证与可发布内容,渲染和布局代码无改动。已通过产物读回复核内容差异。

English verdict: REQUEST_CHANGES exact head bd974e1. The new local-path delegate publishes three previously rejected root references and rejects a legitimate HTTPS link. The file-URL fix and ordinary HTTPS control work.

if "\x00" in text or _MARKUP_RE.search(text):
raise ValueError(f"{context} must be plain text without markup")
if _LOCAL_PATH_RE.search(text) or _PRIVATE_RELATIVE_PATH_RE.search(text):
if find_public_safe_local_path(text) or _PRIVATE_RELATIVE_PATH_RE.search(text):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

实际发布用同一个合成提供者和相同输入做了前后对照。这个委派漏掉原先拒绝的目录根引用,也会挡住带 DNS 根点的正常 HTTPS 链接。请在共享检测中保留完整的目录根覆盖,并按 URL 上下文识别普通链接。补验拒绝时旧快照不变,以及合法链接可写入后按摘要读回。

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · Gemini · Google (self_reported)

[P2] 修改 PRESENTATION_LOCAL_PATH_PATTERNS 后未同步 TypeScript 镜像导致双端测试失败与脱敏漂移

  • Trigger / 触发条件:在 public_safe_text.py 中向 PRESENTATION_LOCAL_PATH_PATTERNS(及 PRESENTATION_PUBLIC_BOUNDARY_PATTERNS)加入了 MULTI_SLASH_LOCAL_PATH_PATTERN,但未同步更新声明与之保持镜像的 global_risk_read.ts。
  • Observed Outcome / 实际结果:双端正则一致性测试 tests/test_global_risks_path_pattern_parity.py::test_global_risks_path_patterns_match_python_owner 在基准 ff9054376 通过(1 passed),而在当前提交 bd974e1f4e0cfa2ffa27692fd9c3c71274137758 失败(1 failed,长度 4 对 5 且第 3 项不匹配)。直接调用两者脱敏路径时,Python redact_public_text 会将 ///opt/a.log 和 //Volumes/disk/x 脱敏为 <local-path-redacted>,而 TypeScript global_risk_read.ts 的 LOCAL_PATH_PATTERNS 仍原样保留这两个连续斜杠路径。
  • Minimum Repair / 最小修复:同步更新 loopx/control_plane/presentation/global_risk_read.ts 中的 LOCAL_PATH_PATTERNS(或评估本 PR 是否应改动 PRESENTATION_LOCAL_PATH_PATTERNS),使双端对全部展示根目录和连续斜杠前缀保持一致,并跑通 uv run --extra test python -m pytest tests/test_global_risks_path_pattern_parity.py -q 与 npm run test:control-plane。

[P2] presentation._plain_text 委托共享检测后放行以分隔符结尾的目录根引用

  • Trigger / 触发条件:presentation.py 将原来的 _LOCAL_PATH_RE 替换为 find_public_safe_local_path(text),而扩展视图中的标题等文本只包含目录根引用且以根分隔符结尾(如 see /home/、see /home/ next、see ///var/、see C:\、see D:/)。
  • Observed Outcome / 实际结果:LOCAL_PATH_SURFACE_PATTERN 与 MULTI_SLASH_LOCAL_PATH_PATTERN 均要求根目录后至少跟一个非空白字符,而 LOCAL_PATH_BOUNDARY_REFERENCE_PATTERN 仅覆盖了少数几个根目录前缀,遗漏了 /home/、/var/、多斜杠根及 Windows 盘符根。在同一个真实发布入口 publish_extension_projection 上做基准对照:基准 ff9054376 全部拒绝上述输入并保持已有快照字节与 payload_sha256 不变;当前提交 bd974e1f4e0cfa2ffa27692fd9c3c71274137758 全部成功发布并可通过 read_extension_projection 读回,违背了非静默放宽承诺。
  • Minimum Repair / 最小修复:在共享路径检测或展示边界保留原有完整目录根形态(含单/多斜杠 Unix 根、盘符根与 ~ 根),并通过真实 publish_extension_projection + read_extension_projection 回归测试验证拒绝时旧快照与摘要保持不变。

[P2] 合法 https:// 链接在扩展展示校验中被误判为本地路径

  • Trigger / 触发条件:扩展公开视图文本包含合法 https:// 链接,且紧邻 /home/、/tmp/ 等路径段前出现非字母数字及非 :/ 字符,例如带 DNS 根点的 https://docs.example.test./home/overview、https://docs.example.test./tmp/guide,IPv6 字面量主机 https://[::1]/home/overview,或查询参数中的路径形态 https://example.com/docs?next=/home/alice。
  • Observed Outcome / 实际结果:基准 ff9054376 的 _LOCAL_PATH_RE 要求路径位于行首、空白或左括号之后,因此上述链接均可正常通过 publish_extension_projection 发布并读回;当前提交委托给 find_public_safe_local_path 后,LOCAL_PATH_SURFACE_PATTERN 的单字符负向后顾 (?<![:/A-Za-z0-9]) 会放行域名末尾的 .、IPv6 的 ],而 LOCAL_PATH_BOUNDARY_REFERENCE_PATTERN 会命中查询参数中的 =,导致以上合法 https:// 链接全部以 must not contain a local path 被拒绝(去掉根点的对照 https://docs.example.test/home/overview 则仍可发布)。
  • Minimum Repair / 最小修复:在共享路径识别器或边界判定中按完整 URL 上下文区分普通 http:// / https:// 链接与本地文件系统引用,继续拒绝 file:// URL 与同一字段内混杂的真实本地路径,并用真实发布与读回用例验证正反两向。

动机 / Motivation

扩展作者在发布公开展示面板、控制面调用方在校验公开输出时,需要稳定拦截指向本地文件系统的路径泄漏,同时不能把正常说明文档的 HTTP(S) 链接挡在门外。在合并基线 ff9054376 上,presentation._plain_text 与 validate_public_safe_value 对同一批文本在两个方向上互相冲突:例如 file:// 本地文件链接、path: 前缀以及键值赋值形态的受限目录路径会被 validate_public_safe_value 拒绝,却在扩展展示入口直接放行;而 ///tmp/a.log 等双斜杠以上前缀在扩展展示被拒,在 validate_public_safe_value 与内部状态校验中却被放行。本 PR 旨在把 presentation._plain_text 的绝对/前缀本地路径判断收敛到共享 owner find_public_safe_local_path,为共享 owner 与 TypeScript 内部状态校验补齐多斜杠绝对路径识别,并修正 loopx/contract.py 在测试清册中的说明理由;不涉及短赋值凭据阈值、内部状态整体放宽或其他尚未迁移的调用面。然而在当前提交 bd974e1f4e0cfa2ffa27692fd9c3c71274137758 上实测发现,该合并引入了三处可复现回归:TypeScript 展示脱敏镜像失配导致现有 parity 测试失败、以分隔符结尾的目录根引用被静默放行,以及带 DNS 根点或 IPv6 主机的合法 https:// 链接被误拒,当前尚不能视为可合入的完整收敛。

改动思路 / Approach

从真实入口与数据流来看,presentation.py 的 publish_extension_projection 在写入持久化信封前调用 validate_opaque_presentation_view 与 _plain_text,并在拒绝时通过异常中止写入、维持已有快照和 payload_sha256 不变;另一条热路径 validate_public_safe_value 与能力包校验(decision_context/packets.py、material_lifecycle/_validation.py)则直接消费 public_safe_text.py 中的 find_public_safe_local_path,而全局风险与状态投影的展示脱敏由 PRESENTATION_LOCAL_PATH_PATTERNS 及其 TypeScript 镜像 global_risk_read.ts 共同承担。

真实入口验证观察项 基线 ff9054376 候选 bd974e1f4e 结论
file:// 路径、path: 前缀与赋值受限路径 publish_extension_projection 发布并读回 拒绝并保持原快照不变 预期收紧成立
连续斜杠子路径(如 ///tmp/a.log) presentation 拒绝,validate_public_safe_value 放行 两侧统一拒绝 预期收敛成立
裸目录根(see /home/、see ///var/、see C:\、see D:/) 拒绝并保持原快照不变 发布成功并可读回 静默放宽回归
合法链接 https://docs.example.test./home/overview 发布成功并可读回 误拒并保留原快照 URL 误伤回归
普通对照 https://example.com/docs 与 the token budget is 1200 发布成功并可读回 发布成功并可读回 对照正常
双端脱敏镜像 test_global_risks_path_pattern_parity.py PASS(1 passed) FAIL(index 2 失配) 跨运行时漂移

就架构边界而言,路径识别逻辑应由 loopx/public_safe_text.py 单一持有,loopx/extensions/presentation.py 只保留相对私有目录(.codex、.git、.local)策略及拒绝时的原子不覆写保证;若修改了 PRESENTATION_LOCAL_PATH_PATTERNS,则必须同步更新 TypeScript 镜像 global_risk_read.ts,并先在共享 owner 补全根目录覆盖与 URL 上下文区分后再切换 _plain_text 委托。本 PR 应收敛为:在共享层保留裸目录根覆盖与普通 HTTP(S) URL 豁免、完成 presentation._plain_text 与 validate_public_safe_value 的双向等价对齐,并保证 PRESENTATION_LOCAL_PATH_PATTERNS 与 global_risk_read.ts 同步通过测试;不扩展至其他未迁移模块或凭据阈值改动。

具体改动 / Changes

本次评审精确提交 bd974e1f4e0cfa2ffa27692fd9c3c71274137758(基线 ff905437669054465a4d7aa8c70ba3396aaf9182),共改动 9 个文件(+229 / -14):3 个生产源码文件(loopx/public_safe_text.py、loopx/extensions/presentation.py、loopx/control_plane/goals/vision_checkpoint.ts)与 6 个测试/语料文件。

关键代码讲解

  • loopx/public_safe_text.py — MULTI_SLASH_LOCAL_PATH_PATTERN 与 PRESENTATION_LOCAL_PATH_PATTERNS:在 源码 L246-L251 新增匹配 /{2,} 已知根的规则并加入 PUBLIC_SAFE_LOCAL_PATH_PATTERNS 及 _SHAPE_DETECTORS,使 find_public_safe_local_path 与 classify_private_text 统一覆盖连续斜杠形态,同时保持 find_private_text_match(publication tier)边界不动。但 源码 L310、L348 同时改写了 PRESENTATION_LOCAL_PATH_PATTERNS 与 PRESENTATION_PUBLIC_BOUNDARY_PATTERNS,未同步修改其 TypeScript 镜像。
  • loopx/extensions/presentation.py — _plain_text:在 源码 L169 删除本地 _LOCAL_PATH_RE,改用 find_public_safe_local_path(text) or _PRIVATE_RELATIVE_PATH_RE.search(text)。由于共享正则对部分根目录要求后接非空白字符、且未按完整 URL 上下文豁免 http(s)://,直接暴露了上述放宽与误拒两条行为偏差。
  • loopx/control_plane/goals/vision_checkpoint.ts — LOCAL_PATH_SHAPE:在 源码 L202 将内部状态检测中的 / 改为 /{1,},与 Python classify_private_text 在内部状态层级保持一致,未改变 PRIVATE_TEXT_PATTERNS。
  • tests/control_plane/test_public_safety_credential_caller_faces.py — DECLARED_OPEN_SITES:在 源码 L259-L267 纠正 loopx/contract.py 的保留理由。经实测核验,contract.py 确实通过 CREDENTIAL_ENVIRONMENT_REFERENCE_PATTERN 与 CREDENTIAL_VARIABLE_REFERENCE_PATTERN 放行代码变量/环境引用(例如环境变量查找表达式或变量引用赋值在 contract.py 判定为引用放行,而 find_private_text_match 直接拒绝),并通过 CREDENTIAL_HIGH_ENTROPY_VALUE_PATTERN 拦截高熵值,理由修正准确且未改动运行时行为。

规范与验收标准映射

按 issue #5136 维护者裁定(参考基线 ff905437669054465a4d7aa8c70ba3396aaf9182)逐项核对:

  • D3-LOCAL-PATH -> implemented:loopx/public_safe_text.py::MULTI_SLASH_LOCAL_PATH_PATTERN 补齐连续斜杠子路径识别,相关语料与对齐测试通过。
  • D3-NO-SILENT-LOOSENING -> not_met:presentation._plain_text 迁移后静默放行 see /home/、see ///var/、see C:\、see D:/ 等裸目录根引用。
  • D3-URL-SAFE -> not_met:presentation._plain_text 新增误拒带 DNS 根点或 IPv6 方括号的合法 https:// URL,违反不得误伤普通 HTTP URL 的约束。
  • D3-RUNTIME-PARITY -> not_met:修改 PRESENTATION_LOCAL_PATH_PATTERNS 后未更新 TypeScript 镜像 global_risk_read.ts,导致 tests/test_global_risks_path_pattern_parity.py 失败。
  • D1-CONTRACT-REASON -> implemented:tests/control_plane/test_public_safety_credential_caller_faces.py::DECLARED_OPEN_SITES 修正了 loopx/contract.py 的保留原因,与实际代码规则一致。

对主干的风险 / Risks

如果将当前提交直接合入主干,会带来三方面直接风险:第一,破坏 tests/test_global_risks_path_pattern_parity.py 测试套件,并使 TypeScript /loopx-global-risks 呈现层与 Python presentation/public_safety.py 在多斜杠本地路径脱敏上产生双端行为漂移;第二,允许包含敏感目录根引用(如 /home/、///var/、C:\、D:/)的公开扩展视图写入持久化快照并被读回;第三,阻塞扩展在公开视图字段中发布包含合法特殊域名或 IPv6 主机形态的 https:// 文档链接。

语义与 CI 对齐

  • 语义对齐判定(violated):loopx/public_safe_text.py 中的 PRESENTATION_LOCAL_PATH_PATTERNS 是受跨语言 parity 约束的公开展示边界规则,本次 PR 向其追加 MULTI_SLASH_LOCAL_PATH_PATTERN 时未同步修改 loopx/control_plane/presentation/global_risk_read.ts 的 LOCAL_PATH_PATTERNS,导致双端契约失配,需先对齐双端或收敛修改面后复跑 pytest tests/test_global_risks_path_pattern_parity.py。
  • 本地全量/聚焦验证结果:
    • 聚焦与相关 Python 测试(12 个测试文件):PASS(863 passed)。
    • 全局风险 parity 及扩展示例/上下文测试(9 个测试文件):FAIL(476 passed, 1 failed,唯一失败为本 PR 引入的 tests/test_global_risks_path_pattern_parity.py::test_global_risks_path_patterns_match_python_owner;基线 ff9054376 为 1 passed)。
    • TypeScript 类型检查与 5 组控制面测试(typecheck:control-plane + public_safe_text_corpus / direction_baseline / global_risk_read / content_digest_single_owner / vision_checkpoint):PASS(104 passed)。
    • ruff check(改动 Python 文件):PASS;mypy --strict --follow-imports=silent 在 loopx/public_safe_text.py PASS,在 loopx/extensions/presentation.py 报 2 处基线已有类型错误(L446、L813,与本 PR 无关)。
    • loopx canary premerge --tier quick --from-git-diff(挂载 node_modules 运行 TS 扫描):PASS(semantic-vocabulary-drift-smoke.py 通过;control-plane-maintainability-ratchet-smoke.py 为与本 PR 改动文件无关的已有提示 advisory_inherited_failure);loopx check --scan-path 0 错误。按仓库策略未等待或查询远端 GitHub Actions CI。

我的整体评价 / Verdict

当前 PR 在 ff9054376 到 bd974e1f4e0cfa2ffa27692fd9c3c71274137758 上准确识别并统一了 issue #5136 表格中的五类代表性本地路径形状,DECLARED_OPEN_SITES 修正也有实测支撑,但在工程完整性上存在三处可复现阻塞缺陷:新增规则未同步至 TypeScript 镜像导致 test_global_risks_path_pattern_parity.py 失败、扩展展示端对裸目录根存在静默放宽、以及对合法 https:// 链接出现新的误拒。另外需注意 public_safe_compact_text 仍默认沿用 LOCAL_PATH_SURFACE_PATTERN(本 PR 未声明迁移该辅助函数),且 vision_checkpoint.ts 的 LOCAL_PATH_SHAPE 同样沿用了单字符负向后顾。本次改动不涉及页面渲染与视觉排版(loopx/extensions/presentation.py、loopx/public_safe_text.py、loopx/control_plane/goals/vision_checkpoint.ts 均无渲染层变更),视觉评审不适用,未覆盖域为 none。从可观察语义与长程演进看,presentation._plain_text 的静默放宽和合法链接误拒会直接影响扩展投影的持久化发布与回读,属于明确回归。请在修复上述三项问题(补全目录根覆盖、按完整 URL 上下文放行合法 HTTP(S) 链接、并同步 global_risk_read.ts 使 test_global_risks_path_pattern_parity.py 转绿)后提交新 head 进行复审;复审需在真实 publish_extension_projection + read_extension_projection 路径验证旧快照保留与新读回两向对照。

English verdict: REQUEST_CHANGES exact head bd974e1. Three verified regressions block approval: (1) adding MULTI_SLASH_LOCAL_PATH_PATTERN to PRESENTATION_LOCAL_PATH_PATTERNS without updating loopx/control_plane/presentation/global_risk_read.ts breaks tests/test_global_risks_path_pattern_parity.py and causes TS/Python redaction drift; (2) delegating presentation._plain_text to find_public_safe_local_path silently accepts bare directory-root references (e.g. /home/, ///var/, C:, D:/) that baseline rejected; and (3) valid https:// URLs with DNS root dots, IPv6 host brackets, or path-like query parameters are newly rejected. Focused Python (863 passed) and TS control-plane suites (104 passed) pass, while test_global_risks_path_pattern_parity.py fails on head after passing on base.

@mergify

mergify Bot commented Nov 20, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @gcl-coder.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added needs-rebase Mergify: the pull request has merge conflicts with its base branch and removed needs-rebase Mergify: the pull request has merge conflicts with its base branch labels Nov 20, 2026
@gcl-coder

Copy link
Copy Markdown
Contributor Author

已按这轮评审的三项意见完成,并额外收掉了一个同类缺口。当前 head 8fb1e868b(5 个提交,13 个文件,+446/−32),与最新主干 cc5392e95 的合并状态为干净(mergeable)。

针对 presentation.py:169 的三项回归:

  1. 裸目录根不被放宽:/home/、///var/、C:\ 这类根后没有内容的写法保持基线的拒绝判定;共享检测器只负责其余形状。真实扩展发布测试确认被拒视图的旧投影字节与 payload_sha256 不变。
  2. 普通 HTTP(S) 链接不再误拒:匹配本地路径前先把 http(s):// URL 整体遮蔽并保留字符位置;覆盖结尾带点的主机、IPv6 authority、路径形查询值,以及 URL 路径里带 /Users/ 段的情况。file:// 与 path: 仍按本地路径处理,凭据检测仍读原值。
  3. TypeScript 镜像同步:global_risk_read.ts 补上连续斜杠与目录根规则;vision_checkpoint.ts 的 /Users/ 与本地路径臂同样先遮蔽 URL。

另补了共享语料一行(URL 内含 /Users/ 段的公开链接),让 Python 与 TypeScript 两端同一条规则被钉住。

验证(本机真实源码、隔离环境):

  • 376 passed:owner parity、凭据调用面、路径形状、文本预算、global-risk parity。
  • 82 passed:扩展呈现与 presentation public safety,含真实 publish_extension_projection 发布/读回对照。
  • 8 passed:TypeScript 语料套件;npm run typecheck:control-plane 通过;ruff check 全过。
  • loopx canary premerge --tier quick --from-git-diff:3 项选中检查,0 失败,1 条 advisory(维护性棘轮命中不在改动文件内)。

另:该文件原先与主干上同一处未使用导入修复冲突,已把该文件对齐主干版本,PR 现在可干净合并。

Windows 文件系统、已安装分发与托管 CI 日志仍未在本地覆盖。

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent | gpt-6.1-sol | OpenAI | runtime_reported | low

[P2] 保留外层 path: 引用后再豁免 URL

mask_http_url_paths 会把 path:/https://example.com/doc 中的 https://example.com/doc 全部遮掉,留下 path:/ 和空格,后续 PATH_PREFIX_LOCAL_PATTERN 因没有路径尾部而不匹配。这是外层已明确标为本地引用的 POSIX 路径,内部 HTTP 形状不应覆盖它的上下文。相同输入在基准共享 owner 命中且嵌套 validate_public_safe_value 拒绝,当前 head owner 未命中、递归 guard 接受;扩展也能发布并按摘要读回。相关代码。先识别并保留显式 path: 本地引用边界,再仅豁免真正的独立 HTTP(S) URL;补验 path:/https://example.com/doc 在公开递归校验中仍拒绝,普通链接仍接受。

动机 / Motivation

公开扩展发布者与生成嵌套公开输出的调用者,需要拒绝明确的本地文件引用,同时保留正常资料链接。原先同一 file URL、path 前缀和多斜杠路径在扩展视图与公共 guard 两向漂移,导致泄漏或重复人工修正。当前改动统一 owner 并修复上轮目录根与合法链接问题,但上述显式本地引用又从拒绝变为接受,仍需修正。显式 path: 引用仍可被 URL 掩码误放行;#5136 其他未迁移表面继续由原 issue 跟踪。

相同 headline 为 path:/https://example.com/doc 时,基准共享 owner 命中且嵌套公开 guard 拒绝;候选掩掉 https://example.com/doc 后两者放行,扩展发布后也能按摘要读回。旧三项问题已通过当前验证;新显式 path: 反例仍失败。不改凭据短赋值策略、扩展执行权限、快照格式或其他领域能力;未测试真实外部扩展、Windows 主机或页面渲染。

改动思路 / Approach

共享 public_safe_text 继续拥有文本分类,presentation 只保留相对私有目录策略;递归 public-output guard 与 TypeScript Vision 镜像消费既有规则。URL 豁免应服从显式本地引用上下文,不应让字符串内出现 HTTP 方案就消除外层本地语义。本 PR 限于本地路径识别、扩展视图发布和受影响镜像;不要求完成 #5136 全部凭据与调用方迁移。与维持两份绝对路径规则相比,删除扩展副本是合理的,TS 镜像则继续由同一语料和 parity 测试约束。最小修复应落在共享上下文判断;给每个调用者再加一个例外会重新制造规则分叉。

发布流程仍先验证 provider 的 view,再交原写入器生成 envelope,消费者用 revision 和摘要读回。验证异常时原文件字节保持,本 PR 没有把检测结果提升为扩展执行权限,也没有新增持久状态或自动重试。

具体改动 / Changes

精确 head 8fb1e868b6bb36fbcb12f869cde90576bbce558f,基准 ff905437669054465a4d7aa8c70ba3396aaf9182;完整范围 13 文件 +446/-32。另区分上轮 bd974e1f4e0cfa2ffa27692fd9c3c71274137758 后的三个修复提交:补根目录、同步展示镜像、豁免 URL。旧发现已在当前 head 实测修复,不能因此直接继承整份批准。

关键代码讲解

  • mask_http_url_paths(loopx/public_safe_text.py:292)整体遮掉 HTTP 字符串;本次问题是未保留外层 path: 上下文。
  • find_public_safe_local_path(同文件 629 行)先掩码再查所有路径臂,因此该错误传播到递归公开 payload 与扩展视图,而不是只影响一个 helper。
  • _plain_text(loopx/extensions/presentation.py:153)移除独立绝对路径 regex,保留私有相对目录和凭据策略;真实拒绝发生在写快照之前。
  • validatePublicSafeText(vision_checkpoint.ts:364)只让本地路径两臂使用掩码;凭据与组织标记仍检查原文。global_risk_read.ts 已同步 Python 展示路径模式,parity 测试通过。

依据 维护者方向,修订标识 issuecomment-5857977250:direction-3-local-reference not_met,原因是显式 path 引用反例;direction-3-public-link implemented,三类普通链接可发布读回;direction-4-real-entrypoint implemented,真实 provider/快照、嵌套 payload 和跨语言验证已执行。未把同一 issue 的全部后续迁移当成本 PR 前置义务。

发布前 head 从 d0f1832 更新到 8fb1e86,唯一新增 diff 是 steward 测试 import 区一行空白;生产实现、依赖、语料和受测调用者均不变。已对新 head 重新执行 453 Python、87 TS、类型检查、同一真实发布反例和标准 premerge,当前结论绑定新 head。

对主干的风险 / Risks

PASS:453 项 Python、87 项 TypeScript、控制面类型检查和标准 premerge;premerge 有一项未改动范围的 inherited maintainability advisory,无 blocking failure。未查询远端 CI。12 类输入在同一脚本、显式 source checkout、immutable base/head 各运行一次。目录根、单独普通链接、链接之外混合真实路径、file URL 与普通 prose 均对照;拒绝时验证了旧快照字节,接受时按摘要读回。

FAIL:明确 path:/https://example.com/doc 的 nested public guard 从基准拒绝变为候选接受。扩展入口在基准也漏拒该值,因此这里区分“公共 guard 新退化”和“扩展迁移仍未闭合”,没有把旧扩展缺口误称为新回归。输入可作为 POSIX 路径,path: 正是现有 owner 明确识别的本地定位符;修复需验证外层定位符的优先级,并保留独立 URL 放行对照。

语义与 CI 对齐

沿用已有 local_path 类别,没有新增公共枚举;新 URL 豁免改变已有 consumer 的默认接受集合,必须满足显式本地引用仍拒绝的合同。测试全部通过未覆盖这一反例,因此不能由 green gate 推导语义正确。先识别并保留显式 path: 本地引用边界,再仅豁免真正的独立 HTTP(S) URL;补验 path:/https://example.com/doc 在公开递归校验中仍拒绝,普通链接仍接受。

我的整体评价 / Verdict

REQUEST_CHANGES。当前单一 owner 与真实发布边界的设计适当,目录根、合法链接和双端镜像旧问题已修;需要先修 URL 掩码对显式本地引用的吞并。长程恢复与原子快照 owner 保持,公开输出安全性出现上述具体退化。范围继续限于现有本地路径迁移,不要求扩展至凭据或新状态机。

视觉评审不适用:完整 diff 无页面、组件、卡片结构或排版改动,内容通过真实发布与读回验证;未覆盖真实第三方扩展、Windows 主机和页面渲染。验证并不证明已经安装或部署。修复后重跑该反例与现有根目录、HTTP URL、嵌套 guard、跨语言语料和标准 premerge。

English verdict: REQUEST_CHANGES exact head 8fb1e86. Earlier root, URL and mirror findings are fixed, but URL masking now lets an explicit path: local reference bypass the previously rejecting public-output guard.

Comment thread loopx/public_safe_text.py

return HTTP_URL_SURFACE_PATTERN.sub(lambda match: " " * len(match.group(0)), value)


Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] URL 豁免前保留外层 path: 本地引用。path:/https://example.com/doc 中的 HTTP 子串被整体掩掉后,只剩 path:/ 和空格,PATH_PREFIX_LOCAL_PATTERN 无法命中。同一嵌套 validate_public_safe_value 在 immutable base 拒绝、此 head 接受;真实扩展也能发布并按摘要读回。该字符串外层明确指向 POSIX 本地路径,不能因路径成分包含 HTTP 形状而豁免。请在共享 owner 保留显式本地上下文的优先级,并补验上述拒绝、旧快照不变和独立 HTTP URL 放行。

@gcl-coder

Copy link
Copy Markdown
Contributor Author

CI 说明:当前 head 8fb1e868b 上失败的 kernel-contracts / checks / pytest / build / merge-gate / stage2c-correctness-e2e 不是本 PR 引入的。

  • kernel-contracts 的根因是 loopx/control_plane/work_items/interaction_contract.py:1004 的 mypy 报错(settlement_plan 参数类型);该文件不在本 PR 的 13 个改动文件内。最新主干 cc5392e95 的同一检查(job 136054220472)出现完全相同的报错。
  • checks 直接报 kernel-contracts must be success,其余几项是该失败与 prepare 的级联。
  • prepare 的失败是 scripts/runtime_artifact.py 的 Runtime default contract is unqualified for public adoption,同样不在本 PR 改动范围内。

本 PR 的本地验证(公共安全 376 项、呈现 82 项、TypeScript 语料 8 项、ruff、control-plane typecheck、quick premerge)均已通过。等主干上的上述失败修复后,这里会重新跑一轮。

@gcl-coder

Copy link
Copy Markdown
Contributor Author

Replying to review 5987313145 at d18fd5843.

The path: finding is fixed. mask_http_url_paths now keeps the whole reference when an explicit path:/ or path:\ locator directly precedes the URL-shaped tail, so path:/https://example.com/doc stays visible to PATH_PREFIX_LOCAL_PATTERN instead of collapsing to path:/ plus spaces. validate_public_safe_value rejects it again at scalar, nested-value and nested-key depths, while a standalone https://example.com/doc still masks and is accepted. The check reuses the same (?<![\w:]) boundary the path arm uses, so xpath:/... is not treated as a locator.

Verification: 52 path-shape tests, 489 public-safety/presentation tests (5 unrelated SQLite-runtime qualification failures on this machine's Node 23.11 / SQLite 3.49), 8 TypeScript corpus tests, and ruff check on the changed files.

loopx-agent
loopx-agent previously approved these changes Nov 20, 2026

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · Gemini · Google DeepMind · self_reported

对精确提交 d18fd584399e1bf6504d5a516c2e5e44a4222833(相对基线 ff905437669054465a4d7aa8c70ba3396aaf9182)执行独立复审。上轮提交 8fb1e868b6bb36fbcb12f869cde90576bbce558f 已修复目录根漏拒、global_risk_read.ts 镜像漂移与合法 HTTP(S) URL 误拒,但留下 mask_http_url_paths 吞并 path:/https://example.com/doc 的 [P2] 退化;当前提交 d18fd58439 新增 EXPLICIT_PATH_PREFIX_AT_END_PATTERN 保留外层 path: 定位符上下文。经真实 publish_extension_projection、validate_public_safe_value、vision_checkpoint.ts 与全套 Python/TS/premerge 验证对照,已无阻塞缺陷(no blocking finding),给出 APPROVE。

动机 / Motivation

受影响的是发布扩展公开展示投影的扩展提供方与视图校验调用方(publish_extension_projection -> validate_opaque_presentation_view),以及控制面/能力包递归公开输出校验(validate_public_safe_value)和 Vision 检查点(vision_checkpoint.ts)的调用方。

改动前(ff9054376),扩展展示 _plain_text 与控制面 validate_public_safe_value 对本地路径产生双向分歧:前者放行 file_url_home、path_prefixed_home 与 boundary_assignment_private 三类局部路径写法并写入快照,却拒绝 ///tmp/a.log 等连续斜杠前缀;后者则相反。改动后,_plain_text 将绝对/前缀/文件 URL 路径判断委托给共享 owner find_public_safe_local_path,共享 owner 补齐 MULTI_SLASH_LOCAL_PATH_PATTERN 与目录根可选尾部,同时新增 mask_http_url_paths 先豁免独立 http(s):// 链接再匹配本地路径(并保留外层 path:/ 本地定位符上下文),TypeScript 镜像 global_risk_read.ts 与 vision_checkpoint.ts 同步更新。从可观察结果看,在真实 publish_extension_projection / read_extension_projection 入口与 validate_public_safe_value 递归校验的基线/候选对照中,五类分歧样本、裸目录根(/home/、///var/、C:\、D:/)及显式 path:/https://example.com/doc(标量、嵌套值、嵌套键及混合字段)在当前提交均被两处边界一致拒绝且保持旧快照字节不变;普通与特殊形式 HTTPS 文档链接(尾点域名、IPv6 主机、路径形查询参数、含主目录段路径)均可发布并按摘要读回;Python 与 TypeScript 语料及 global_risks 正则 parity 全部通过。

本 PR 不修改 loopx/contract.py 的代码期凭据判断逻辑(仅修正 DECLARED_OPEN_SITES 说明),不裁决 #5136 方向 2 的短赋值凭据阈值,不改动扩展快照格式或凭据正则,也不迁移尚未列入本切片的其他调用面。

改动思路 / Approach

本次设计将“公开本地路径判断”与“独立 HTTP(S) URL 语法豁免”统一由 loopx/public_safe_text.py 单一持有,各下游公开边界按各自职责消费同一组规则:

flowchart TD
    A["输入文本 (扩展视图 / validate_public_safe_value / 内部状态)"] --> B["mask_http_url_paths(value)"]
    B --> B1{"URL 前紧邻 path:/ 或 path:\?"}
    B1 -->|是 (EXPLICIT_PATH_PREFIX_AT_END_PATTERN)| C1["保留整段不掩码 -> PATH_PREFIX_LOCAL_PATTERN 命中拒绝"]
    B1 -->|否 (独立 http/https 链接)| C2["空格掩码 HTTP(S) URL (保留字符偏移)"]
    C1 --> D["本地路径正则检测 (单斜杠/多斜杠/目录根/~/file:///:=边界)"]
    C2 --> D
    D -->|命中或命中 .codex/.git/.local| E1["拒绝发布/导出; 原投影快照字节不变"]
    D -->|未命中| E2["凭据与敏感词检测仍读取原始未掩码文本 -> 通过后发布并可按摘要读回"]
Loading

注:以上流程图为根据精确提交 d18fd584399e1bf6504d5a516c2e5e44a4222833 源码 mask_http_url_paths 与 _plain_text 推导的说明图,不替代实测。

在架构设计与当前边界上,本 PR 将本地路径识别与 HTTP(S) URL 掩码逻辑单一收敛到 loopx/public_safe_text.py,删除 presentation.py 重复的绝对路径正则并仅保留其独有的相对私有目录策略(.codex/.git/.local),同时以语料与 parity 测试锁定 TypeScript 镜像 vision_checkpoint.ts 与 global_risk_read.ts,避免了在每个调用面打补丁造成的规则分叉。当前 PR 边界:限定在公开输出本地路径识别收敛、扩展展示视图委托、TypeScript Vision/Global-Risk 镜像同步与 contract.py 声明理由修正;其余调用面迁移与短赋值策略仍由 #5136 跟踪。

具体改动 / Changes

完整 ff905437669054465a4d7aa8c70ba3396aaf9182..d18fd584399e1bf6504d5a516c2e5e44a4222833 差异共 14 个文件、+463 / -32 行(相对 origin/main 同步一致;tests/test_steward_generic_monitor_todo.py -1 行为对齐主干的未使用导入清理,对 origin/main 净差异为 0):

  • 生产运行时(5 文件,+112 / -20):loopx/public_safe_text.py(+80/-8)、loopx/control_plane/goals/vision_checkpoint.ts(+15/-3)、loopx/control_plane/runtime/public_safety.py(+9/-3)、loopx/extensions/presentation.py(+6/-5)、loopx/control_plane/presentation/global_risk_read.ts(+2/-1)。
  • 测试与语料(9 文件,+351 / -12):tests/extensions/test_extension_presentation.py(+177)、tests/control_plane/test_public_safe_text_owner_parity.py(+60)、tests/fixtures/public_safe_text_corpus.json(+48)、tests/control_plane/test_public_safe_local_path_owner.py(+27)、tests/control_plane_ts/public_safe_text_corpus.test.ts(+27)、tests/control_plane/test_public_safety_credential_caller_faces.py(+9/-8)、tests/control_plane/test_public_safety_text_budget.py(+5)、tests/control_plane/test_public_safety_path_shapes.py(+1)、tests/test_steward_generic_monitor_todo.py(-1)。

关键代码讲解

  1. mask_http_url_paths 与 EXPLICIT_PATH_PREFIX_AT_END_PATTERN:使用等长空格替换独立的 http(s):// 链接以保持偏移一致,同时在替换前检查前缀是否匹配 (?<![\w:])path:[\\/]$,确保 path:/https://example.com/doc 与 PATH:\https://example.com/doc 保留完整串供 PATH_PREFIX_LOCAL_PATTERN 命中,而 xpath:/... 不会被误判为定位符;凭据检测始终读取原始文本。
  2. LOCAL_PATH_SURFACE_PATTERN、MULTI_SLASH_LOCAL_PATH_PATTERN 与 find_public_safe_local_path:补齐双斜杠及以上 Unix 绝对根路径,并将单/多斜杠目录根、Windows 盘符根及 ~/ 尾部改为可选 (?:[^\s'"<>]+)?,同时在 find_public_safe_local_path与classify_private_text的本地路径分支先执行mask_http_url_paths,保证公开 http(s)` URL 中的主目录路径段不被误伤。
  3. _plain_text 与 public_safe_compact_text:_plain_text 删除本地 _LOCAL_PATH_RE 并委托给 find_public_safe_local_path,仅将相对私有目录 .codex/.git/.local 留在扩展展示策略;public_safe_compact_text 同步在默认 LOCAL_PATH_SURFACE_PATTERN 分支对输入做 URL 掩码,使合法路径形 URL 不再被压缩摘要误删。
  4. validatePublicSafeText 与 LOCAL_PATH_PATTERNS:vision_checkpoint.ts 同步 LOCAL_PATH_SHAPE 的多斜杠与可选尾部并仅对本地路径/主目录两条规则使用 maskHttpUrlPaths(凭据与组织关键词仍检原文);global_risk_read.ts 同步 MULTI_SLASH_LOCAL_PATH_PATTERN 与目录根规则,使双端展示脱敏恢复一致。

规范与验收标准映射

依据维护者架构指引 issuecomment-5857977250(修订 issuecomment-5857977250)逐项核对:

  • direction-1:implemented — 路径识别收敛至 loopx/public_safe_text.py::find_public_safe_local_path,presentation._plain_text 移除私自副本,Python 与 TypeScript 通过 tests/fixtures/public_safe_text_corpus.json 与 test_global_risks_path_pattern_parity.py 保持同语义。
  • direction-2:implemented — 普通 http(s):// 链接仅在本地路径检测臂掩码豁免(实测含 token=... 查询的 URL 仍被凭据检测拒绝),loopx/contract.py 在 DECLARED_OPEN_SITES 的留存原因已修正为代码期凭据判断;短赋值阈值与内部状态 URL 逐面策略仍属原 issue 后续范围。
  • direction-3:implemented — 补齐 2+ 斜杠根、file://、path:、目录根与 := 边界在扩展展示和 validate_public_safe_value 的双向一致拒绝,且 path:/https://example.com/doc 在两处及嵌套键/值深度均保持拒绝,同时普通/根点/IPv6/查询参数 HTTP(S) 链接不被误伤。
  • direction-4:implemented — 新增语料 local_path_shapes 与 ordinary_public_url_home_directory_segment、真实 publish_extension_projection / read_extension_projection(验证拒绝时旧快照字节不变)、嵌套 payload 校验及双端 parity 测试均已落地并通过。

对主干的风险 / Risks

  1. 基线与精准反例对比验证(PASS):对 22 类代表性输入在同一套脚本下对比 ff905437669054465a4d7aa8c70ba3396aaf9182 与 d18fd584399e1bf6504d5a516c2e5e44a4222833 的 publish_extension_projection、validate_public_safe_value(标量、嵌套值、嵌套键)、public_safe_compact_text、classify_private_text 与 redact_public_text,并实测 build_vision_checkpoint:
    • 已修复的 path: 回归:path:/https://example.com/doc、PATH:\https://example.com/doc、path://https://example.com/doc、path:/a/https://example.com/doc 及混合字段 https://example.com/docs and path:/https://example.com/doc 在 publish_extension_projection(拒绝并保持已有快照字节不变)与 validate_public_safe_value 三层深度均一致拒绝。
    • 双向收敛与目录根:file_url_home、path_prefixed_home、boundary_assignment_private 在扩展展示入口从基线放行收紧为拒绝;slash_run_tmp、slash_run_users 与目录根(/home/、///var/、C:\、D:/)在展示与导出守卫均保持拒绝且旧快照字节不变。
    • 合法 HTTP(S) 链接与凭据正反对照:https://example.com/docs、https://docs.example.test./home/overview、语料 ordinary_public_url_home_directory_segment(带根点与主目录路径段的 HTTPS 链接)、https://[2001:db8::1]/home/overview、https://docs.example.com/?next=/home/overview 与普通文本 the token budget is 1200 在展示发布读回、递归公开校验与 vision_checkpoint 均放行;带凭据查询参数的 URL(?token=abcdefghijklmnop)与混合本地路径的文本仍正确拒绝。
  2. 语义对齐(semantic_alignment: aligned):沿用既有 local_path 分类与已有公开边界异常契约,未新增或修改公共枚举;global_risk_read.ts 与 Python PRESENTATION_LOCAL_PATH_PATTERNS 经双端正则测试验证完全对齐(注:展示脱敏列表的第一条既有 /(Users|home|private|tmp|var)/ 规则保持基线行为,用于面板摘要脱敏而非 _plain_text 拒绝)。
  3. 本地全量/聚焦验证结果(PASS):
    • 聚焦 Python 测试(7 个文件,含 test_global_risks_path_pattern_parity.py、test_extension_presentation.py、test_public_safe_text_owner_parity.py、test_public_safe_local_path_owner.py、test_public_safety_path_shapes.py、test_public_safety_credential_caller_faces.py、test_public_safety_text_budget.py):505 passed;test_steward_generic_monitor_todo.py:1 passed;架构边界与预算测试(3 个文件):39 passed。
    • TypeScript 控制面检查(挂载 node_modules):npm run typecheck:control-plane 0 错;public_safe_text_corpus.test.ts + content_digest_single_owner.test.ts + global_risk_read.test.ts + vision_checkpoint.test.ts:57 passed(0 错)。
    • ruff check(10 个改动/测试 Python 文件):0 错;mypy --follow-imports=silent 在 public_safe_text.py 与 public_safety.py 0 错,loopx/extensions/presentation.py 仅余 2 处基线已有 L446/L813 类型提示(非本 PR 引入);loopx check --scan-path 对全部 14 个文件扫描 0 错;check_rfc_bilingual.py 通过。
    • loopx canary premerge --tier quick --from-git-diff --git-diff-base origin/main(挂载 node_modules):ok: true(semantic-vocabulary-drift-smoke.py 与 monitor-scheduler-contract-smoke.py 通过,保留 1 项与本 PR 无关的 interaction_contract.py 既有可维护性提示)。未查阅远端 GitHub Actions CI(wait_for_ci: false)。
  4. 残余风险:Windows 实际控制台路径行为(POSIX 跳过项)及未在本切片迁移的其他 #5136 开放调用面继续在各自边界下跟踪。

我的整体评价 / Verdict

从 long_horizon 维度评估为 preserved:本次收敛不改变调度、Todo、Turn 或快照原子写入契约,拒绝发布时维持已有扩展投影快照字节与 payload_sha256 不变。从 user_experience 维度评估为 improved(visual_review 为 not_applicable:完整 diff 仅涉及文本与载荷校验规则、TypeScript 镜像及测试语料,未修改任何网页组件、卡片结构或视觉布局。 未验证范围:Windows 主机真实文件系统、未涉及的第三方外部扩展以及前端页面视觉渲染。):扩展展示与递归公开守卫对本地路径与目录根达成一致拦截,同时不再误拒含合法路径段的 http(s):// 文档链接,且 path:/https://... 的外层本地引用上下文回归已彻底修复。

在体量与工程契约上,代码规模(14 文件 +463/-32)属 necessary 与 proportionate,共享单一 owner 与跨语言语料架构评估为 retain,兼容性评估为 retain(保持既有错误提示与 find_private_text_match 发布层级边界),语义对齐为 aligned(决策 reuse_existing,未新增状态词汇),default_off_isolation 与 authority_semantics 均不涉及新增开关或 actor 权限模型。所有必核证据均在精确提交 d18fd584399e1bf6504d5a516c2e5e44a4222833 实测通过,无阻塞项,结论为 APPROVE。

English verdict: APPROVE at d18fd58. Re-review confirms EXPLICIT_PATH_PREFIX_AT_END_PATTERN keeps explicit path: locators rejected across validate_public_safe_value (scalar/nested) and publish_extension_projection while preserving ordinary/root-dot/IPv6/query http(s):// URLs, bare directory roots, and global_risk_read.ts parity. Focused Python (505 + 1 + 39 arch passed), TS (57 passed, tsc 0 errors), Ruff, boundary scan, and quick premerge all pass.

A home-directory name inside an ordinary http(s) URL is a URL path segment, the same as the /home/ links the presentation guard already keeps. Mask the URL for the /Users/ local-path arm in the Python classifier and the TypeScript Vision checkpoint, pin the row in the shared corpus, and stay raw on the publication tier.

Signed-off-by: ChengLong GU <[email protected]>
An explicit path: locator owns the token after it, so a value like path:/https://example.com/doc must stay visible to the local-path arm instead of being masked into path:/ plus spaces. Ordinary HTTP(S) links still mask and remain accepted. Refs loopx-project#5136.

Signed-off-by: ChengLong GU <[email protected]>
…ential

The ordinary_public_url_home_directory_segment row added by this PR is intentionally released by the internal-state tier while the publication tier keeps rejecting it as a remote location. Record it in the named release list and assert its category, so the differential matches the change it describes. Refs loopx-project#5136.

Signed-off-by: ChengLong GU <[email protected]>
@gcl-coder
gcl-coder force-pushed the codex/public-boundary-local-path branch from 25a68b9 to 26d5794 Compare November 21, 2026 04:59
@gcl-coder

Copy link
Copy Markdown
Contributor Author

Rebased onto 2b6dfe0a7. Head is now 26d579430, mergeable.

While rebasing I found and fixed a test-only gap the environment had been hiding: test_both_tiers_differ_from_the_old_rule_only_where_this_change_says needs the new ordinary_public_url_home_directory_segment corpus row listed as an intentional release, with remote_location as its category. Heads-up: that test reaches the TypeScript runtime host, so inside a sandbox it fails for unrelated reasons; run it outside one.

Verification on the new base: 521 public-safety/presentation tests, 8 TypeScript corpus tests, and the control-plane typecheck pass.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

发布扩展投影或复用对外摘要的调用方,需要在同一边界得到一致的本机路径判断。 过去展示和公开输出各自判断本机路径,部分输入得到相反结论。新版复用共享路径规则,同时接受普通的公开文档链接。 当前提交保留显式本机引用的拒绝、普通 HTTPS 的显示,以及拒绝发布时原投影和摘要的完整性。 此次只调整公开文本的路径和链接判别,凭据判定与各目的地独有政策仍由原契约负责。

改动思路 / Approach

共享路径判定归入现有文本 owner,目的地继续决定适用的严格级别。 核验的生产边界包括现有扩展投影、Vision、风险读回和发布检查。 前一轮提出的显式路径分类问题已在当前提交修复。我核对了新增回归和普通链接对照,拒绝发布时保留前一投影。 保留既有的拒绝判定和原数据归属,当前补丁无需引入第二套状态机。

具体改动 / Changes

以当前目标基线 2b6dfe0 的既有契约为依据,逐项核对期望行为。 原有契约

  • PATH-OWNER 已实现。现有共享 owner 覆盖受影响的路径形式。 核对了 find_public_safe_local_path 和实际入口。
  • URL-PARITY 已实现。普通公开链接保持可用,显式本机引用继续拒绝。 核对了 mask_http_url_paths 和实际入口。
  • PUBLICATION-STATE 已实现。失败的发布保留前一版本及摘要。 核对了 publish_extension_projection 和实际入口。

当前提交保留显式本机引用的拒绝、普通 HTTPS 的显示,以及拒绝发布时原投影和摘要的完整性。 此次只调整公开文本的路径和链接判别,凭据判定与各目的地独有政策仍由原契约负责。

对主干的风险 / Risks

独立重跑 549 项 Python、8 项 TypeScript 共享语料,Ruff、类型检查和 Git diff 检查通过。 正常路径和拒绝后的状态已在隔离输入上读回。前一轮提出的显式路径分类问题已在当前提交修复。我核对了新增回归和普通链接对照,拒绝发布时保留前一投影。 未验证已安装产品的全部调用方,远端 CI 未检查。

我的整体评价 / Verdict

检查了真实扩展投影写回与拒绝路径,改动没有渲染页面。 未验证已安装产品的全部调用方,远端 CI 未检查。 当前精确提交 26d5794 已满足此修复的边界。

English verdict: APPROVE

@loopx-agent
loopx-agent merged commit 834ccdb into loopx-project:main Nov 21, 2026
42 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants